package code.rocky.chapter04;

// 建议52：推荐使用String直接量赋值
public class Suggest52 {
    public static void main(String[] args) {
        String str1 = "Rocky编程日记";
        String str2 = "Rocky编程日记";
        String str3 = new String("Rocky编程日记");
        String str4 = str3.intern();
        System.out.println("两个直接量是否相等: " + (str1 == str2));
        System.out.println("直接量和对象是否相等: " + (str1 == str3));
        System.out.println("经过intern处理后的对象与直接量是否相等: " + (str1 == str4));
    }
}
